import yRequest from '../index'
import { IALogin, IDataType, ILoginResult } from './type'

//账号登陆请求
enum LoginAPI {
  banner = '/banner?type=2',
  loginUserInfo = '/users/',
  loginUserMenuList = '/role/'
}
export function accountLoginRequest(payLoad: IALogin) {
  //意思是返回的数据类型是IDataType 然后里面的data的数据类型是ILoginResult
  return yRequest.post<any>({
    url: LoginAPI.banner,
    data: payLoad
  })
}

export function accountLoginRequestId(id: number) {
  return yRequest.get<IDataType>({
    url: LoginAPI.loginUserInfo + id,
    showLoading: false
  })
}
export function accountLoginRequestMenuList(id: number) {
  return yRequest.get<IDataType>({
    url: LoginAPI.loginUserMenuList + id + '/menu',
    showLoading: false
  })
}

// yRequest.request({
//   url: '/home/multidata',
//   method: 'GET'
// })
